package top.gangster.lunan.ossservice.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class OSSPropertiesUtil implements InitializingBean {
	@Value("${aliyun.oss.file.endpoint}")
	private String endPoint;

	@Value("${aliyun.oss.file.accesskeyid}")
	private String accessKeyId;

	@Value("${aliyun.oss.file.accesskeysecret}")
	private String accessKeySecret;

	@Value("${aliyun.oss.file.bucketname}")
	private String bucketName;

	public static String END_POINT;
	public static String ACCESS_KEY_ID;
	public static String ACCESS_KEY_SECRET;
	public static String BUCKET_NAME;

	/**
	 * Bean实例创建后执行的方法
	 * 此处用于静态变量的赋值
	 */
	@Override
	public void afterPropertiesSet() {
		END_POINT = this.endPoint;
		ACCESS_KEY_ID = this.accessKeyId;
		ACCESS_KEY_SECRET = this.accessKeySecret;
		BUCKET_NAME = this.bucketName;
	}
}
